package com.qingzhuge.log.controller;

import com.qingzhuge.common.enums.EResourceType;
import com.qingzhuge.controller.BasePkLongController;
import com.qingzhuge.core.annotation.AResource;
import com.qingzhuge.dto.response.ResponseBodyDto;
import com.qingzhuge.log.dto.request.SysLogRequestDto;
import com.qingzhuge.log.dto.response.SysLogResponseDto;
import com.qingzhuge.log.entity.SysLog;
import com.qingzhuge.log.service.ISysLogService;
import com.qingzhuge.utils.PageUtil;
import io.swagger.annotations.Api;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author : zero.xiao
 * @description : 系统日志
 * @date :2018/6/8 0008 下午 14:47
 * @modified :
 */
@Api(tags = "S系统日志")
@AResource(name = "系统日志", type = EResourceType.menu, catalog = "系统管理")
@RestController
@RequestMapping("api/sys/auth/log")
public class SysLogController extends BasePkLongController<SysLog, ISysLogService, SysLogRequestDto, SysLogResponseDto> {

    @Override
    public ResponseEntity<ResponseBodyDto<PageUtil<SysLogResponseDto>>> queryPage(@RequestBody(required = false) SysLogRequestDto param) {
        return super.queryPage(param);
    }

    @Override
    protected ResponseEntity<ResponseBodyDto<PageUtil<SysLogResponseDto>>> doQueryPage(SysLog log) {
        log.setSearchField("username");
        log.setUsername(getUsername());
        return super.doQueryPage(log);
    }
}
